package com.gopay.common.constants.fund.rtfund;

import java.util.ArrayList;
import java.util.List;

/**
 * 融通基金快捷网点ID枚举
 * @author yu_liu6@hnair.com
 * @date 2018-01-18 14:52:23
 */
public enum RtfundEpChannelIdEnum {

    GOPAY("GFB1", "GOPAY","国付宝余额账户"),
    //中行和农行暂不支持，测试银行上线前需要关闭
//    BC("GOPAY01", "BC","中国银行"),
    ICBC("GOPAY02", "ICBC","中国工商银行"),
//    ABC("GOPAY03", "ABC","中国农业银行"),
//    TBANK("GOPAY04", "TBANK","测试银行"),
    SPDB("GOPAY05", "SPDB","浦发银行"),
    CEB("GOPAY06", "CEB","光大银行"),
    CITIC("GOPAY07", "CITIC","中信银行"),
    PAB("GOPAY08", "PAB","平安银行"),
    ;

    private String channelId;
    private String code;
    private String channelName;

    RtfundEpChannelIdEnum(String channelId, String code, String channelName){
        this.channelId = channelId;
        this.code = code;
        this.channelName = channelName;
    }

    public String getCode() {
        return code;
    }
    public String getChannelId() {
        return channelId;
    }

    public String getChannelName() {
        return channelName;
    }

    /**
     * 根据银行代码返回融通基金增卡所需的网点枚举
     * @param bankCode
     * @return
     */
    public static RtfundEpChannelIdEnum getChannelByBankCode(String bankCode){
        for(RtfundEpChannelIdEnum channel : RtfundEpChannelIdEnum.values()){
            if(channel.getCode().equals(bankCode)){
                return channel;
            }
        }
        return null;
    }

    /**
     * 获取活期宝在融通基金可支持的银行代码
     * @return
     */
    public static List<String> getBankCodes(){
        List<String> codes = new ArrayList<>(RtfundEpChannelIdEnum.values().length);
        for(RtfundEpChannelIdEnum channel : RtfundEpChannelIdEnum.values()){
            codes.add(channel.getCode());
        }
        return codes;
    }
}
